<template>
     <h2 style="text-align: center;">物联网金融系统-登录</h2>
     <table>
          <tr>
            <td>用户名</td>
            <td><input type="text" placeholder="请输入用户名" v-model="info.username"></td>
          </tr>
          <tr>
            <td>密码</td>
            <td><input type="password" placeholder="请输入密码" v-model="info.password"></td>
          </tr>
          <tr>
            <td colspan="2" style="text-align: center;"><button @click="login(info.username)">登录</button></td>
          </tr>
     </table>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import {useRouter} from  'vue-router'

const router = useRouter()

const info = ref({
    username: '',
    password: ''
})

const login = (name: string) =>{
     if(info.value.username=='admin' && info.value.password=='123456'){
         alert('登录成功')
         router.push({
              path:"/Admin",
              query:{
                  username: name
              }
         })
     }else{
         alert('登录失败')
     }
    
}
</script>